package com.hxzy.controller;

import com.hxzy.pojo.Book;
import com.hxzy.pojo.BookType;
import com.hxzy.service.BookService;
import com.hxzy.service.BookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author lzj
 * @create 2020-11-09 下午 4:58
 */
@Controller
public class BookTypeController {
    @Autowired
    private BookTypeService bookTypeService;


    @RequestMapping("/bookType")
    public ModelAndView bookType(){
        List<BookType> typename = bookTypeService.selectAll();
        ModelAndView mav = new ModelAndView();
        mav.addObject("typename",typename);
        mav.setViewName("manager/book_edit");
        return mav;
    }



    @RequestMapping("/add")
    public String add(BookType bookType){
        bookTypeService.add(bookType);
        return "client/index";
    }
}
